<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div class="easyui-layout" fit="true">
  <div region="center" style="padding:0px;border:0px">
  <t:datagrid name="dictCategoryList" checkbox="false"
  	 fitColumns="true" title="我的培训申请" actionUrl="trainApplyInfoController.do?datagrid" idField="id" fit="true" queryMode="group">
   <t:dgCol title="主键"  field="id"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="申请人"  field="applyUser.realName"   query="false" queryMode="single"  width="60"></t:dgCol>
   <t:dgCol title="培训名称"  field="trainItem.trainningName"   query="true" queryMode="single"  width="100"></t:dgCol>
   <t:dgCol title="实验室"  field="trainItem.lab.name"   query="false" queryMode="single"  width="100"></t:dgCol>
   <t:dgCol title="培训工种"  field="trainItem.teachItem.itemName"   query="true" queryMode="single"  width="70"></t:dgCol>
   <t:dgCol title="报名时间"  field="createDate" formatter="yyyy-MM-dd hh:mm" queryMode="single"  width="90"></t:dgCol>
   <t:dgCol title="在线考试分数"  field="onlineExamScore"   query="false" queryMode="single"  width="80"></t:dgCol>
   <t:dgCol title="线下操作分数"  field="offlineExamScore"   query="false" queryMode="single"  width="80"></t:dgCol>
   <t:dgCol title="是否获取预约资格"  field="isPassed"  formatterjs="getIsPassed"  query="false" queryMode="single"  width="80"></t:dgCol>
    <t:dgCol title="操作" field="opt" width="100"></t:dgCol>
   <t:dgFunOpt  funname="goExam(id)" title="开始考试"  exp="onlineExamScore#empty#true"/>
   <t:dgFunOpt  funname="showExam(id)" title="查看考试结果"  exp="onlineExamScore#empty#false"/>
   <t:dgFunOpt  funname="goViewFiles(id)" title="查看资料" />
    <t:dgToolBar title="申请培训" icon="icon-add" url="trainApplyInfoController.do?goAdd" funname="add" height="180" width="560"></t:dgToolBar>
   </t:datagrid>
  </div>
 </div>
 <script type="text/javascript">
 $(document).ready(function(){
 	//给时间控件加上样式
 	$("#dictGroupListtb").find("input[name='createDate']").attr("class","Wdate").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd'});});
 });
 
function getPeopleCount(v,rec){
	return rec['enterCount']+"/"+rec['maxEnterCount'];
}

function getIsPassed(v,rec){
	if(1==v){
		return '已获取';
	}else{
		return '未获取';
	}
}

 function goViewFiles(id){	 
	 createwindow("查询预习资料",'trainItemController.do?goViewFiles&ownerId='+id,500,400);
 }

function goExam(id){
	$.dialog.confirm('确定要开始考试吗？',function(r){
		if(r){
			 window.location.href="trainExamController.do?goExam&id="+id; 
		}
	});
}

 
function showExam(id){
	window.location.href="trainExamController.do?showExamResult&applyId="+id;
}

 
 </script>